/// <reference path="./../storage/BaseStorage.ts" />
/// <reference path="./../storage/StorageMgr.ts" />
/// <reference path="./../utils/EventDispatcher.ts" />

namespace apeng {

    export class BaseModule {
        /**模块缓存 */
        public storage: BaseInstanceStorage = null!

        /**自身 new 时 */
        public onBeforeInstance?(): void
        /**自身 new 时 */
        public onInstance?(): void

        /**初始化自身模块数据 可以引用其他模块实例 但不能调用或使用 */
        public onCreate?(): void
        /**所有 onCreate 执行完后 可引用模块 跑逻辑 */
        public onLogic?(): void
        /**所有 onLogic 执行完后 */
        public onComplete?(): void
    }

    export class BaseModuleEvent extends EventDispatcher implements BaseModule {

        public storage: BaseInstanceStorage = null!
        public onBeforeInstance?(): void
        public onInstance?(): void
        public onCreate?(): void
        public onLogic?(): void
        public onComplete?(): void
    }


}